package com.example.user.model.vo;

import com.example.common.validator.Insert;
import com.example.common.validator.Update;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

import java.io.Serializable;

@Data
@EqualsAndHashCode()
@ToString
public class UserVO implements Serializable {
    @NotNull(groups = {Update.class}, message = "主键不能为空")
    private Long id;

    private String name;

    private String password;

    @Pattern(groups = {Insert.class, Update.class}, regexp = "^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\\.[a-zA-Z0-9-]+)*\\.[a-zA-Z0-9]{2,6}$",message = "邮箱格式不正确")
    @NotBlank(groups = {Update.class}, message = "邮箱不能为空")
    private String email;

    @NotBlank(groups = {Insert.class}, message = "手机号不能为空")
    @Pattern(groups = {Insert.class, Update.class}, regexp = "^1\\d{10}$",message = "手机号格式不正确")
    private String mobile;

    private int age;

    private int sex;

    private int status;
}
